package org.androidpn.utils;

import android.os.Handler;
import android.os.Looper;
import android.os.Message;

/**
 * @author liduchang
 * @date 2015/8/22 13:48
 * @description
 */
public class UIHandler extends Handler {
    private IHandlerListener mHandler;

    public UIHandler(Looper looper) {
    }

    public UIHandler(Looper looper, IHandlerListener handler) {
    }

    public void setHanderListener(IHandlerListener handler) {
        mHandler = handler;
    }

    @Override
    public void handleMessage(Message msg) {
        if (mHandler != null) {
            mHandler.handleMessage(msg);
        }
        super.handleMessage(msg);
    }

    public interface IHandlerListener {
        void handleMessage(Message msg);
    }
}
